home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.02 Feb 91 / Jorg Source / MacTutorDoc.cp < prev    next >
Encoding:
Text File  |  1990-12-18  |  1.3 KB  |  62 lines  |  [TEXT/MPS ]

  1. #include <Types.h>
  2. #include <QuickDraw.h>
  3. #include <Fonts.h>
  4. #include <Events.h>
  5. #include <OSEvents.h>
  6. #include <Controls.h>
  7. #include <Windows.h>
  8. #include <Menus.h>
  9. #include <TextEdit.h>
  10. #include <Dialogs.h>
  11. #include <Desk.h>
  12. #include <Scrap.h>
  13. #include <ToolUtils.h>
  14. #include <Memory.h>
  15. #include <SegLoad.h>
  16. #include <Files.h>
  17. #include <OSUtils.h>
  18. #include <Traps.h>
  19. #include <StdLib.h>
  20.  
  21. #include "TDocument.h"
  22. #include "TApplication.h"
  23. #include "MacTutorDoc.h"
  24.  
  25. // create and delete document windows
  26.  
  27. // we pass the resID parameter up to our base class,
  28. // which actually creates the window for us
  29. TMacTutorDocument::TMacTutorDocument(short resID, StringPtr s)    : (resID)
  30. {
  31.     SetDisplayString(s);
  32.     ShowWindow(fDocWindow);        // Make sure the window is visible
  33. }
  34.  
  35. TMacTutorDocument::~TMacTutorDocument(void)
  36. {
  37.     HideWindow(fDocWindow);
  38. }
  39.  
  40. void TMacTutorDocument::DoUpdate(void)
  41. {
  42.     BeginUpdate(fDocWindow);                // this sets up the visRgn 
  43.     if ( ! EmptyRgn(fDocWindow->visRgn) )    // draw if updating needs to be done 
  44.       {
  45.         DrawWindow();
  46.       }
  47.     EndUpdate(fDocWindow);
  48. }
  49.  
  50. // Draw the contents of an application window. 
  51.  
  52. void TMacTutorDocument::DrawWindow(void)
  53. {
  54.     SetPort(fDocWindow);
  55.     EraseRect(&fDocWindow->portRect);
  56.     
  57.     MoveTo(100,100);
  58.     TextSize(18); TextFont(monaco);
  59.     DrawString(fDisplayString);
  60.     
  61. } // DrawWindow
  62.